<template>
  <view class="login-page">

    <view class="login-layout">
      <!-- 顶部返回 -->
      <view class="login-top">
        <view class="login-booth"></view>
        <view class="login-back">
          <text class="iconfont icon-weibiaoti--10" @click="closeMenu"></text>
        </view>
      </view>
      <!-- 登录方式切换 -->
      <view class="login-way">
        <text
          :class="active == 0 ? 'active' : ''"
          @click="(active = 0), (showPassword = false)"
          >快捷登录注册</text
        >
        <text :class="active == 1 ? 'active' : ''" @click="active = 1"
          >密码登录</text
        >
      </view>

      <view class="login-box">
        <view class="login-input">
          <input
            class="uni-input"
            placeholder="请输入手机号"
            v-model="username"
            placeholder-class="placeholder-style"
          />
          <text class="verify-code" @click="clearUsername" v-if="active == 0"
            >发送验证码</text
          >
        </view>
        <view class="login-input">
          <input
            class="uni-input"
            placeholder="请输入验证码"
            :password="showPassword"
            v-model="password"
            placeholder-class="placeholder-style"
          />
          <text
            class="iconfont end-icon icon-weibiaoti--34"
            v-if="active == 1"
            @click="showPassword = !showPassword"
          ></text>
        </view>
        <text class="forget" v-if="active == 1">忘记密码</text>
      </view>

      <view class="login-button" @click="loginFn">登录</view>
      <view class="radio-box">
        <label class="radio"
          ><radio
            :checked="checked"
            @click="checked = !checked"
            activeBackgroundColor="#0077ff"
          />
          <text>我已同意并阅读</text>
          <text class="user-terms">《用户条款和相关服务协议》</text>
        </label>
      </view>

      <view class="other-login">
        <view class="icon-text">
          <text>其他登录方式</text>
        </view>
        <view class="login-icon">
          <view class="icon-image">
            <image src="/static/icon/weixin.png"></image>
          </view>
          <view class="icon-image">
            <image src="/static/icon/shouji.png"></image>
          </view>
        </view>
      </view>

      <view class="login-bottom">
        <text class="logo">LOGO</text>
        <text class="logo-text">https://gitee.com/Subtop @次顶级</text>
      </view>
    </view>
  </view>
</template>

<script>
import { defineComponent, ref } from "vue";
import { useMixin } from "./mixins";
export default defineComponent({
  name: "login004",
  props: {},
  components: {},
  setup() {
    const mixin = useMixin();
    const checked = ref(false);
    const active = ref(0);
    const closeMenu = () => {
      // 提示
      uni.showToast({
        title: "执行返回",
        icon: "seccess",
      });
    };
    return {
      active,
      checked,
      closeMenu,
      ...mixin,
    };
  },
});
</script>

<style lang="less" scoped>
.login-page {
  width: 100%;
  height: 100vh;
  background: #ffffff;
  overflow: hidden;
}

.login-layout {
  .login-top {
    height: 160rpx;
    .login-booth {
      width: 100%;
      height: 80rpx;
    }
    .login-back {
      width: 100%;
      height: 80rpx;
      .icon-weibiaoti--10 {
        line-height: 80rpx;
        padding-left: 20rpx;
        font-size: 34rpx;
      }
    }
  }
  .login-way {
    padding: 0 40rpx;
    color: #aaaaaa;
    margin-top: 30rpx;
    text {
      margin-right: 60rpx;
    }
    .active {
      color: #000;
      font-size: 46rpx;
    }
  }
  .login-box {
    width: 100%;
    padding: 0 40rpx;
    box-sizing: border-box;
    .login-input {
      position: relative;
      .uni-input {
        border-bottom: 1rpx solid #eeeeee;
        height: 80rpx;
        line-height: 80rpx;
        margin-top: 40rpx;
        box-sizing: border-box;
        //   placeholder样式修改
        .placeholder-style {
          color: #cccccc;
          font-size: 30rpx;
        }
      }

      .verify-code {
        font-size: 26rpx;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
      }
    }
    .forget {
      width: 100%;
      text-align: right;
      display: block;
      margin-top: 20rpx;
      font-size: 24rpx;
    }
    .end-icon {
      font-size: 30rpx;
      position: absolute;
      color: #999;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
    }
  }
  .login-button {
    width: 90%;
    margin: 0 auto;
    background: #fa9600;
    height: 80rpx;
    line-height: 80rpx;
    text-align: center;
    border-radius: 40rpx;
    color: #fff;
    font-size: 30rpx;
    margin-top: 100rpx;
    transition: all 0.3s;
    &:active {
      background: #9e5f00;
    }
  }
  // 其他登录方式
  .other-login {
    width: 100%;
    box-sizing: border-box;
    margin-top: 140rpx;
    .icon-text {
      text-align: center;
      color: #333;
      font-size: 26rpx;
      color: #777;
    }
    .login-icon {
      margin-top: 50rpx;
      display: flex;
      justify-content: space-between;
      padding: 0 150rpx;
      .icon-image {
        width: 50rpx;
        height: 50rpx;
        padding: 10rpx;
        background: #fff;
        border-radius: 50%;
        border: 2rpx solid #0077ff;
        image {
          width: 100%;
          height: 100%;
        }
      }
    }
  }

  /deep/ .uni-radio-input {
    width: 20rpx !important;
    height: 20rpx !important;
  }
  .radio-box {
    width: 100%;
    margin-top: 20rpx;
    padding: 0 40rpx;
    .radio {
      font-size: 22rpx;
      .user-terms {
        color: #0077ff;
      }
    }
  }

  .login-bottom {
    position: fixed;
    width: 100%;
    padding: 10rpx 40rpx;
    box-sizing: border-box;
    bottom: 10rpx;
    display: flex;
    justify-content: center;
    // 底部对齐
    align-items: center;
    .logo {
      font-size: 40rpx;
      color: #fa9600;
      font-weight: 700;
      margin-right: 20rpx;
    }
    .logo-text {
      font-size: 20rpx;
      color: #999;
    }
  }
}
</style>
